/*
 * @Author: xuxu12138 1718324422@qq.com
 * @Date: 2022-10-15 16:02:02
 * @LastEditors: xuxu12138 1718324422@qq.com
 * @LastEditTime: 2024-08-02 10:08:56
 * @FilePath: /things-admin/src/base/api/HealthApi.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import { Result } from '@/base/Result';
import { request } from '@/base/Request';
import { Page } from '@/base/Page';
import { Health } from '@/base/model/Health';

export function getHealthList(params: {
  pageIndex: number,
  pageSize: number,
  affiliateId: number,
  sortDirection?: string,
  createBegin?: string,
  createEnd?: string
}): Promise<Result<Page<Health>>> {
  return request.getPage(Health, '/api/health', { params });
}

export function deleteHealth(id: number): Promise<Result<void>> {
  return request.delete(`/api/health/${id}`);
}

export const health = (params: {
  pageIndex: number,
  pageSize: number,
  affiliateId:number,
  deviceSn:number
}) => request.get(Health, `/api/health?pageIndex=${params.pageIndex}&pageSize=${params.pageSize}&sortDirection=DESC&affiliateId=${params.affiliateId}&deviceSn=${params.deviceSn}`)
